﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using ESoft.Core.Service;
using ESoft.Domain.Entity;

namespace ESoft.API.Api
{
    /// <summary>
    /// 用户服务
    /// </summary>
    public class UserController : ApiController
    {
        private IBaseService _baseSvc;

        public UserController(IBaseService baseSvc)
        {
            _baseSvc = baseSvc;
        }

        // GET: api/User
        public IEnumerable<UserEntity> Get()
        {
            return _baseSvc.LoadEntities<UserEntity>();
        }

        // GET: api/User/5
        public string Get(int id)
        {
            return "value";
        }

        // POST: api/User
        public UserEntity Post([FromBody]string value)
        {
            UserEntity user = new UserEntity {
                UserName="admin",
              //  LastUpdateBy=
            };
           return _baseSvc.Add<UserEntity>(user);
        }

        // PUT: api/User/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE: api/User/5
        public void Delete(int id)
        {
        }
    }
}
